<?php
namespace Mob\Model;

use Think\Model;
use Think\Hook;
/**操作日志模型
 * Class InfoModel
 */

require_once ('./Application/Mob/Common/function.php');

class OperateModel extends Model {

    protected $tableName = 'operatelog';  //好像有点问题，不知道为啥拼表的时候，不太对。所以指定表名吧。


   public function queryOperType()
   {
   	$operate = M('operatetype'); //初始化表
   return $operate->where('Status = 1')->field('OperateTypeId,OperateName,Desc,shorId')->select();

   }

     /**
	 * cancelTask  取消任务操作
	 * @param $Serialno  任务流水号
	 * @param $cancelUid      操作人员ID
	 * @param $cancelReason 取消原因
	 * @param $cancelDesc   取消描述
	 * @return 是否评价   true =已评价,false=未评价
	*/

   public function cancelTask($Serialno,$cancelUid,$cancelReason,$Describe)
   {
   	$cancel =D('Cancel');
    $cancenid = $cancel->creatorOperate($Serialno,$cancelUid,1,$cancelReason,$Describe);

     return $cancenid;


   }
    /**
	 * requestCancelTask  申请取消任务
	 * @param $Serialno  任务流水号
	 * @param $cancelUid      操作人员ID
	 * @param $cancelDesc   取消描述
	 * @return 是否评价   true =已评价,false=未评价
	*/


   public function requestCancelTask($TaskSerialno,$cancelUid,$Describe)
   {
   $confirmPerson = D('Accept')->getTaskFinaChoice($TaskSerialno)['AcceptUid'];

   if(!$confirmPerson)
   {
   return null;
   }

 	$cancel =D('Cancel');
   $TaskSerialno;  //取任务流水号
   $cancenid = $cancel->creatorOperate($TaskSerialno,$cancelUid,2,null,$Describe,$confirmPerson);
   return $cancenid;


   }



   public function isRequestCancel($Serialno,$CancelType)
   {
   	switch($CancelType)
   	{

   	case 1:
   	break;
   	case 2:
   	break;
   	case 3:
   	break;
   	case 4:
     break;



   	}




   }











}